package pub.cleangao.mqtt;

import lombok.Getter;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;



@Component
public class VzMqttTopics {

    @Autowired
    private VzDevices vzDevices;


    @Getter
    private final static String[] topicsAll = new String[]{
            // 识别结果
            "device/+/message/up/ivs_result",
            // 快速识别结果
            "device/+/message/up/quick_ivs_result",
            // 离线识别结果
            "device/+/message/up/ivs_result_offline",
            // 抓图结果
            "device/+/message/up/snapshot",
            // 发布触发识别
            "device/+/message/down/ivs_trigger",
            // 发布触发识别回执
            "device/+/message/down/ivs_trigger/reply",
            // 发布IO输出事件
            "device/+/message/down/gpio_out",
            //  发布IO输出事件回执
            "device/+/message/down/gpio_out/reply",
            // 发布串口数据转发
            "device/+/message/down/serial_data",
            // 发布串口数据转发回执
            "device/+/message/down/serial_data/reply",
            // 发布设置系统时间
            "device/+/message/down/set_time",
            // 发布设置系统时间回执
            "device/+/message/down/set_time/reply",
            // 发布抓图事件
            "device/+/message/down/snapshot",
            // 发布抓图事件回执
            "device/+/message/down/snapshot/reply",
            // 发布白名单增删改查
            "device/+/message/down/white_list_operator",
            // 发布白名单增删改查回执
            "device/+/message/down/white_list_operator/reply",
            // 订阅IO输入事件
            "device/+/message/up/gpio_in",
            // 订阅串口数据接收
            "device/+/message/up/serial_data",
            // 发布获取设备时间戳
            "device/+/message/down/get_device_timestamp",
            // 发布获取设备时间戳回执
            "device/+/message/down/get_device_timestamp/reply",
            // 发布重启事件
            "device/+/message/down/reboot_dev",
            // 发布重启事件回执
            "device/+/message/down/reboot_dev/reply",
            // 发布云台控制事件
            "device/+/message/down/set_cloud_ctrl",
            //  发布云台控制事件回执
            "device/+/message/down/set_cloud_ctrl/reply",
            // 发布IO锁定事件
            "device/+/message/down/set_io_lock_status",
            // 发布IO锁定事件回执
            "device/+/message/down/set_io_lock_status/reply",
            // 发布获取IO锁定状态
            "device/+/message/down/get_io_lock_status",
            // 发布获取IO锁定状态回执
            "device/+/message/down/get_io_lock_status/reply",
            // 发布获取IO状态
            "device/+/message/down/get_io_status",
            // 发布获取IO状态回执
            "device/+/message/down/get_io_status/reply",
            // 发布车牌加密配置
            "device/+/message/down/set_plate_encryption_cfg",
            // 发布车牌加密配置回执
            "device/+/message/down/set_plate_encryption_cfg/reply",
            // 订阅离线记录数量
            "device/+/message/up/offline_record",
            // 发布离线记录推送命令
            "device/+/message/down/check_offline_record",
            // 发布离线记录推送命令回执
            "device/+/message/down/check_offline_record/reply",
            // 发布设备配置命令
            "device/+/message/down/device_set",
            // 发布设备配置命令回执
            "device/+/message/down/device_set/reply",
            // 订阅道闸状态
            "device/+/message/up/barr_gate_status",
            // 发布TTS语音
            "device/+/message/down/tts_voice",
            // 发布TTS语音回执
            "device/+/message/down/tts_voice/reply",
            // 发布oss配置
            "device/+/message/down/set_oss_cfg",
            // 发布oss配置回执
            "device/+/message/down/set_oss_cfg/reply"
    };



    public void startListen(MqttClient mqttClient) throws Exception {
        mqttClient.subscribe(topicsAll);
        System.out.println("启动全部设备指定主题监听...");
    }
}
